<css href="__PUBLIC__/boot-date/css/bootstrap-datetimepicker.min.css" />
<script src="__PUBLIC__/boot-date/js/bootstrap-datetimepicker.min.js"></script>
<script src="__PUBLIC__/boot-date/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<div class="table-tools">
    <!--<a href="__URL__/addUI" class="btn btn-info" title="添加权限"><i class="fa fa-copy"></i> 添 加 </a>-->
    <!--<button type="submit" class="btn btn-primary" title="删除勾选的资源"><i class="glyphicon glyphicon-remove"></i> 删 除 </button>-->
    <!--<button type="button" class="btn btn-success" title="重新排序资源" onclick="sortQuestions()"><i class="fa fa-copy"></i> 重 排 </button>-->
    <form class="form-inline" method="post" action="__URL__/moneyLog" id="search_form"  role="form">
        <input type="hidden" name="pagenum" id="pagenum_hidden" value="{$page.pagenum}">
        <input type="hidden" name="count" value="{$recordcount}">
        <div class="form-group">
            <input type="text" name="user_id" value="{$user_id}" placeholder="请输入用户id">
            <select  name="money_type" id="money_type" class="form-control">
                <option value="-1">金额类型</option>
                <option value="2">代理收入</option>
                <option value="1">钻石</option>
                <option value="0">金币</option>
            </select>
            <select  name="put_type" id="put_type" class="form-control">
                <option value="-1">收入或支出</option>
                <option value="1">支出</option>
                <option value="0">收入</option>
            </select>
            <select  name="type" id="type" class="form-control">
                <option value="-1">来源</option>
                <option value="16">申请代理</option>
                <option value="15">代理提现</option>
                <option value="14">系统扣除钻石</option>
                <option value="13">系统赠送钻石</option>
                <option value="12">解散房间返还</option>
                <option value="11">报名赛事</option>
                <option value="10">普通用户推广</option>
                <option value="9">打擂</option>
                <option value="8">签到</option>
                <option value="7">抽奖</option>
                <option value="6">摆擂</option>
                <option value="5">比赛获胜</option>
                <option value="4">扣除手续费</option>
                <option value="3">提成</option>
                <option value="2">兑换</option>
                <option value="1">充值</option>
                <option value="0">系统赠送</option>
            </select>

        </div>
        <div class="form-group" style="margin-left: 1%">
            <label class="col-md-6 col-xs-12 control-label" > 开始时间</label>
            <div class="col-md-2">
                <input size="16" type="text" id="startTime" name="startTime" value="{$startTime}" readonly class="start_datetime">
            </div>
        </div>
        <div class="form-group" style="margin-left: 1%">
            <label class="col-md-6 col-xs-12 control-label" >结束时间</label>
            <div class="col-md-2">
                <input size="16" type="text" id="endTime" name="endTime" value="{$endTime}" readonly class="end_datetime">
            </div>
        </div>
        <button style="margin-left: 2%"  type="button" onclick="gotoPage(0)">搜索</button>
    </form>
    <p>用户资金流动列表</p>
</div>

<div id="data_list"></div>
<div class="modal fade" id="my-alert" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">提示</h4>
            </div>
            <div class="modal-body" id="hint_content">
            </div>
            <div class="modal-footer">
                <button type="button" id="close_btn" class="btn btn-default" data-dismiss="modal">关闭</button>
                <!--<button type="button" class="btn btn-primary">Save changes</button>-->
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        gotoPage(0);
    });
    function gotoPage(pagenum) {
        //提交form
        $('#pagenum_hidden').val(pagenum);
        getMoneyLog();
    }
    $(".start_datetime").datetimepicker({
        format: 'yyyy-mm-dd ',
        minView: "month", //选择日期后，不会再跳转去选择时分秒
        language:  'zh-CN',
    }).on('change',function(ev){
        var startDate = $('.start_datetime').val();
        console.info('startDate:'+startDate);
        $(".end_datetime").datetimepicker('setStartDate',startDate);
        $(".start_datetime").datetimepicker('hide');
    });
    $(".end_datetime").datetimepicker({
        format: 'yyyy-mm-dd',
        minView: "month", //选择日期后，不会再跳转去选择时分秒
        language:  'zh-CN',
    }).on('change',function(ev){
        var returnDate = $(".end_datetime").val();
        console.info('returnDate:'+returnDate);
        $(".start_datetime").datetimepicker('setReturnDate',returnDate);
        $(".end_datetime").datetimepicker('hide');
    });
    function getMoneyLog(){
        $.ajax({
            type: "POST",
            url: "__URL__/ajaxMoneyLog",
            async: false,
            data:  $('#search_form').serialize(),
//            dataType: "json",
            success: function (data) {
                $('#data_list').empty().append(data);
            },
            error: function (data) {
                console.info(data);
            }
        });
    }
</script>